package com.dd.cloud.search.entity;

import cn.easyes.annotation.IndexField;
import cn.easyes.annotation.IndexId;
import cn.easyes.annotation.IndexName;
import cn.easyes.common.constants.Analyzer;
import cn.easyes.common.enums.FieldType;
import cn.easyes.common.enums.IdType;
import com.dd.cloud.search.contents.ESConstant;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @Description: es的药品列表模型
 * @Author: czg
 * @Date: 2023/5/25 11:26
 * @Version: 1.0.0
 */

@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@IndexName(value = ESConstant.DRUGS_INDEX, keepGlobalPrefix = true)
public class DrugsEs implements Serializable {

    private static final long serialVersionUID = 8596716425733775320L;


    /**
     * id type为自定义 还有NONE自动生成, UUID生成uuid然后插入
     * 其他注解
     * @IndexField
     * fieldType:类型 (text会被分词器解析, 生成倒排索引, 支持模糊、精确查询, 不用于排序, 很少用于聚合
     *      keyword不进行分词，直接索引, 支持模糊、精确查询, 支持聚合)
     * value:字段名 exist:字段是否存在 fieldDate:text字段是否支持聚合 analyzer:分词器
     * strategy:字段验证策略 dataFault:日期格式 nestedClass:嵌套类
     * parentName:父名称 childName:子类名称
     *
     *  @Score 得分注解
     *  @HighLight 高亮注解
     *
     */
    @IndexId(type = IdType.CUSTOMIZE)
    private Integer id;

    /**
     * 药材名称
     */
    @IndexField(fieldType = FieldType.TEXT,analyzer = Analyzer.IK_SMART)
    private String herbName;

    /**
     * 药材名称拼音首字母
     */
    @IndexField(fieldType = FieldType.TEXT,analyzer = Analyzer.IK_SMART)
    private String herbNamePinyin;

    /**
     * 药材繁体
     */
    @IndexField(fieldType = FieldType.TEXT,analyzer = Analyzer.IK_SMART)
    private String  herbNameTraditional;

    /**
     * 用法及注意事项
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String precautions;

    /**
     * 规格
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String specification;

    /**
     * 药材单位
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String useUnit;

    /**
     * 药材类型 1药材原料 2中成药
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer type;

    /**
     * 状态 1有效 2禁用 3删除
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer status;

    /**
     * 药材别名
     */
    @IndexField(fieldType = FieldType.TEXT,analyzer = Analyzer.IK_SMART)
    private String alias;

    /**
     * 药材别名拼音首字母
     */
    @IndexField(fieldType = FieldType.TEXT,analyzer = Analyzer.IK_SMART)
    private String aliasPinyin;

    /**
     * 药材别名繁体
     */
    @IndexField(fieldType = FieldType.TEXT,analyzer = Analyzer.IK_SMART)
    private String  aliasTraditional;

    /**
     * 备注
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String remarks;

    /**
     * 产地
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String origin;

    /**
     * 操作人id-创建人id
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer operId;

    /**
     * 操作人名字
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String operName;

    /**
     * 药房id
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer pharId;

    /**
     * 药房标识
     */
    @IndexField(fieldType = FieldType.INTEGER)
    private Integer pharFlag;

    /**
     * 创建日期
     */
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDate;

    /**
     * 最小用量
     */
    @IndexField(fieldType = FieldType.DOUBLE)
    private BigDecimal minDose;

    /**
     * 最大用量
     */
    @IndexField(fieldType = FieldType.DOUBLE)
    private BigDecimal maxDose;

    /**
     * 用量单位
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String doseUnit;

    /**
     * 药材单价
     */
    @IndexField(fieldType = FieldType.DOUBLE)
    private Double price;

    /**
     * 药材原价
     */
    @IndexField(fieldType = FieldType.DOUBLE)
    private Double originalPrice;

    /**
     * 药材折扣价
     */
    @IndexField(fieldType = FieldType.DOUBLE)
    private Double discountPrice;

    /**
     * 药材编码
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String drugnum;

    /**
     * 药品公益价格
     */
    @IndexField(fieldType = FieldType.DOUBLE)
    private BigDecimal publicPrice;
}
